package com.neo.consumer;

import com.neo.config.ConfirmConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

/**
 * @ClassName: Consumer
 * @Title: springboot-rabbitmq
 * @Package: com.neo.consumer
 * @Description:
 * @Author: Kisen
 * @Date: 2021/9/27 22:01
 */
@Slf4j
@Component
public class Consumer {

    @RabbitListener(queues = ConfirmConfig.CONFIRM_QUEUE_NAME)
    public void receiveMsg(Message message) throws UnsupportedEncodingException {
        log.info("接收到队列confirm.queue消息：{}", new String(message.getBody(), "UTF-8"));
    }
}
